import axios from "../utils/request";
import path from "./path";

const api = {

    getRequest(url,params,responseType){
         if(responseType != null){
             return axios({
                url:path.baseUrl + url,
                params:{params},
                method:'get',
                responseType: responseType, // 必须项，axios会将文件流转为blob
             })
         }else{
            return axios.get(path.baseUrl + url ,{params})
         }
      
    },
    postRequest(url,data,responseType){
        console.log("responseType=="+responseType);
        if(responseType != null){
            return axios({
                url:path.baseUrl+url,
                data:data,
                method: 'post',
                responseType: responseType, // 必须项，axios会将文件流转为blob
            })
        }
        else{
            return axios.post(path.baseUrl + url ,data)
        }
    }

}

export default api;